<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Language" content="en" />
	<meta name="GENERATOR" content="PHPEclipse 1.2.0" />
	<title>Kết quả tìm kiếm</title>
</head>
<body>
<?php
	
	if($_REQUEST["info"]==null) $info = $_POST["info"];
	else $info = $_REQUEST["info"];
	//echo $info;
	include("include/db_connect.php");
	
	$query = mysql_query("Select * from dc_tour where name like '%$info%'");
	$rowTotal = mysql_num_rows($query);
if($rowTotal!=0)
{
	$rowPage = 1;
	$pageNumber = ceil($rowTotal/$rowPage);
	$pageIndex = $_REQUEST["page"];
	if($pageIndex==null||$pageIndex=="") $pageIndex=1;
	$offset = ($pageIndex-1)*$rowPage;
	
	$query1 = mysql_query("Select * from dc_tour where name like '%$info%' LIMIT $offset,$rowPage ") ;
	
?>
<table width="100%" border="0">
  <caption>
    Danh sách các Tour
  </caption>
  <tr>
    <td>ID</td>
    <td>Tên tour</td>
    <td>Trạng thái</td>
	<td colspan="">Thao tác</td>
  </tr>
  <?php while($row = mysql_fetch_array($query1)){ ?>
  <tr>
    <td><?php echo $row[0]; ?></td>
    <td><?php echo $row[1]; ?></td>
    <td>
    <?php
    	if($row[9]==0) echo "Chưa duyệt";
    	else if($row[9]==1) echo "Đã duyệt"; 
    	else if($row[9]==2) echo "Hết hạn"; 
    ?>
    </td>
	
  </tr>
  <?php } ?>
</table>

<p>
<a href="searchResult.php?page=1&info=<?php echo $info;?>">[First] </a>
<?php

if($pageIndex!=1) echo "<a href='searchResult.php?page=".($pageIndex-1)."&info=$info'>[Previous] </a>";
for($page=1;$page<=$pageNumber;$page++)
{
	if($page==$pageIndex) echo "<strong>".$page."</strong> ";
	else echo "<a href='searchResult.php?page=".$page."&info=$info'>".$page."</a> ";
}
if($pageIndex!=$pageNumber) echo "<a href='searchResult.php?page=".($pageIndex+1)."&info=$info'>[Next] </a>";
?>
<a href="searchResult.php?page=<?php echo $pageNumber; ?>&info=<?php echo $info;?>">[Last]</a>
</p>
<p><a href="searchForm.php"><input type="button" class="button" name="btnBack" value="Quay lại" /></a></p>
<?php
}else{
?>
<p>Không tìm thấy kết quả phù hợp</p>
<p><a href="javascript:history.go(-1)"><input type="button" class="button" name="btnBack" value="Quay lại" /></a></p>
<?php }?>
</body>
</html>
